package com.eleven.mall.controller;

import com.eleven.mall.pojo.PermissionOut;
import com.eleven.mall.pojo.Rbody;
import com.eleven.mall.service.PermissionService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther: Rui_simple
 * @Date: 2022/10/26 13:10
 * @Description: PermissionController
 * @Version 1.0.0
 */
@RestController
@AllArgsConstructor
@CrossOrigin
public class PermissionController {

    PermissionService permissionService;

    @GetMapping("/rights/{type}")
    public Rbody getPermissionList(@PathVariable("type") String type){
        System.out.println("type: "+type);
        List<PermissionOut> premissionOutList = permissionService.getPermissionList();
        System.out.println(premissionOutList);
        Rbody rbody = new Rbody();
        rbody.setData(premissionOutList);
        return rbody;
    }
}
